Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

avoid reparsing numbers when serializing #1074

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

pjfanning
Copy link
Contributor

@pjfanning pjfanning commented Sep 5, 2024

Alternative to #1073

This change avoids creating NumericNodes and parsing strings to numbers which ultimately have to be turned back to strings to write them.

I've had to leave the BigIntegerNode usage in there. Removing it breaks some tests. I've debugged and it is down to how writeNumber(String) is implemented in jackson-databind TokenBuffer. We would need to change this class in jackson-databind to fix this (and that is not likely to happen as it will probably cause other issues). Basically, writeNumber(String) is assumed to be a non-integer in TokenBuffer.

@pjfanning pjfanning marked this pull request as draft September 5, 2024 03:27
@pjfanning pjfanning marked this pull request as ready for review September 5, 2024 03:57
@pjfanning pjfanning force-pushed the faster-number-serialization branch 2 times, most recently from b46b958 to d97f4dd Compare September 5, 2024 04:55
@cchantep
Copy link
Member

Unit test required

@pjfanning
Copy link
Contributor Author

Unit test required

@cchantep I think the existing tests do a good job of testing this code change.

@pjfanning pjfanning mentioned this pull request Sep 15, 2024
5 tasks
Update StringBasedNumericNode.scala

rework

Update JacksonJson.scala

add containsEOrDot

requested changes to containsEOrDot

remove StringBasedNumericNode

imports

remove new function

add test

add int serialization test

Update JsonSpec.scala

Update JsonSpec.scala
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants